package com.adpter;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import com.common.method.ServerPath;
import com.matang.R;
import com.modle.UserAlbum;

public class XcGridAdapter extends CusBaseAdapter {
	Context context;
	ArrayList<UserAlbum> list;

	public XcGridAdapter() {
	}

	public XcGridAdapter(Context context, ArrayList<UserAlbum> list) {
		this.context = context;
		this.list = list;
	}

	@Override
	public int getCount() {
		return list.size();
	}

	@Override
	public Object getItem(int i) {
		return list.get(i);
	}

	@Override
	public long getItemId(int i) {
		return 0;
	}

	@Override
	public View getView(int position, View view, ViewGroup parent) {
		ViewHolder vh = null;
		if (view == null) {
			view = LayoutInflater.from(context).inflate(
					R.layout.list_item_grxc, null);
			vh = new ViewHolder();
			vh.imgView = (ImageView) view.findViewById(R.id.iv);
			view.setTag(vh);
		} else {
			vh = (ViewHolder) view.getTag();
		}
		imageLoader.bind(vh.imgView,ServerPath.SERVER+list.get(position).thumbUrl, null,R.drawable.default_head);

		return view;

	}

	class ViewHolder {
		ImageView imgView;

	}
}
